let f = true;

// window.onload=function (){
//
//     if(f){
//         historyFn();
//         orderFn();
//         collectFn();
//         f=false;
//     }
//
// }

function historyFn(){
    // alert("history")
    window.location.href='/user/history';
}
function orderFn(){
    // alert("order")
    window.location.href='/user/order';
}
function collectFn(){
    // alert("collect")
    window.location.href='/user/collect';
}








let btn1=document.querySelector('#shopping')
let alertEl1=document.querySelector('.alert-shopping')
// shopping
btn1.onclick=function(){
    alertEl1.style.display='flex'
}

//shopping
let btnClose1=document.querySelector('#idClose')
btnClose1.onclick=function(){
    alertEl1.style.display='none'

}

/*点击遮罩关闭弹窗  */
alertEl1.onclick=function(e){
    console.log(e)
    // 点击内容的时候，弹窗不关闭
    if(e.target==alertEl1){
        alertEl1.style.display='none'
    }
}


let btn2=document.querySelector('#purchase')
let alertEl2=document.querySelector('.alert-purchase')

// purchase
btn2.onclick=function(){
    alertEl2.style.display='flex'
}

// purchase
//获得关闭按钮
let btnClose2=document.querySelector('#idPurchase')
btnClose2.onclick=function(){
    alertEl2.style.display='none'
}

/*点击遮罩关闭弹窗  */
alertEl2.onclick=function(e){
    console.log(e)
    // 点击内容的时候，弹窗不关闭
    if(e.target==alertEl2){
        alertEl2.style.display='none'
    }
}






let btn3=document.querySelector('#history')
let alertEl3=document.querySelector('.alert-history')

// history
//获取button的value属性
btn3.onclick=function(){
    // let userId = btn3.val();
    // let userid = btn3.getAttribute("value");
    // window.location.href='user/MyHistoryRecord/'+userid;

    alertEl3.style.display='flex'
}

// history
//获得关闭按钮
let btnClose3=document.querySelector('#idHistory')
btnClose3.onclick=function(){
    alertEl3.style.display='none'
}

/*点击遮罩关闭弹窗  */
alertEl3.onclick=function(e){
    console.log(e)
    // 点击内容的时候，弹窗不关闭
    if(e.target==alertEl3){
        alertEl3.style.display='none'
    }
}



let btn4=document.querySelector('#joinShopping')
let alertEl4=document.querySelector('.alert-joinShopping')

// joinShopping
btn4.onclick=function(){
    alertEl4.style.display='flex'
}

// joinShopping
let btnClose4=document.querySelector('#idJoin')
btnClose4.onclick=function(){
    alertEl4.style.display='none'
}

/*点击遮罩关闭弹窗  */
alertEl4.onclick=function(e){
    console.log(e)
    // 点击内容的时候，弹窗不关闭
    if(e.target==alertEl4){
        alertEl4.style.display='none'
    }
}

